/*=============================================================================

  MANAGER IDLE STATE MODULE

  FILE: SYSmgr_S_IDL.cpp
  
  DESCRIPTION

    Manager Idle State Implementation

  EXTERNALIZED FUNCTIONS

    
  Copyright (c) DaeSung Engineering Inc. All rights reserved.

=============================================================================*/
/*=============================================================================

                             EDIT HISTORY

  ---------  -------  -------------------------------------------------------
    when       who     what, where, why
  ---------  -------  -------------------------------------------------------
   06/28/03   nso4th   Version 0.1

=============================================================================*/

/*=============================================================================
  HEADER INCLUSION
=============================================================================*/
#include "SYSmgr.h"

/*=============================================================================
  CONSTANT DEFINITION
=============================================================================*/

/*=============================================================================
  LOCALIZED VARIABLE DEFINITION
=============================================================================*/
static dword	gStep = STATE_INIT_STEP;
#define SETSTEP(s)		((gStep) = (s))
#define GETSTEP()		(gStep)

/*=============================================================================
  EVENT PROCESSING
=============================================================================*/
dword SYSmgr::IDL_STATE(dword dwType, dword dwEvent, dword wParam, dword lParam)
{
	dword		st = m_mnState[IDL_S];
	
	switch(st)
	{
	case IDL_IDL_S:
		return	IDL_ProcIDL(dwType, dwEvent, wParam, lParam);
	case IDL_ERR_S:
		return	IDL_ProcERR(dwType, dwEvent, wParam, lParam);
	}

	return	FALSE;
}

dword SYSmgr::IDL_ProcIDL(dword dwType, dword dwEvent, dword wParam, dword lParam)
{
	dword		event, evtID;

	event = HDEV_GETEVENT(dwEvent);
	evtID = HDEV_GETDEV_ID(dwEvent);

	if(IS_CMD_EVENT(dwType))
	{
		switch(event)
		{
		case STATE_STOP_C:
			break;
		}
		return	TRUE;
	}
	else if(IS_STATE_EVENT(dwType))
	{
		if(MON_IsLock() == TRUE)
			return	TRUE;
		
		return	TRUE;
	}
	
	return	FALSE;
}

dword SYSmgr::IDL_ProcERR(dword dwType, dword dwEvent, dword wParam, dword lParam)
{
	dword		event, evtID;

	event = HDEV_GETEVENT(dwEvent);
	evtID = HDEV_GETDEV_ID(dwEvent);

	if(IS_CMD_EVENT(dwType) == FALSE)
		return	FALSE;
	
	switch(event)
	{
	case STATE_STOP_C:
	{
		State_Minor(IDL_IDL_S);
		break;
	}
	}

	return	TRUE;
}

/*--- END OF SYSmgr_S_IDL.CPP ---*/
